package app.itw.tison.cloud.order_service.controller;


import app.itw.tison.cloud.model.Order;
import app.itw.tison.cloud.order_service.service.OrderService;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 订单服务
 */
@RestController
@RequestMapping("/api/v1/order")
public class OrderController {

  @Resource
  private OrderService orderService;

  @GetMapping("/get")
  public Object getUserOrder(String id) {
    Order order = orderService.getOrderByID(id);
    return order;
  }

  @GetMapping("/get_uid")
  public Object getUserOrderByUserID(String userId) {
    Order order = orderService.getOrderByUserID(userId);
    return order;
  }

  @GetMapping("/list")
  public Object getUserOrder() {
    List<Order> list = orderService.getOrderList();
    return list;
  }

}
